昨天的進度雖說是安裝好了 nginx 容器,但若你直接在網址列輸入主機 IP 位置,那麼便會看見 nginx 的預設歡迎頁面。
docker exec <container name / id >
# root@container-id
cd /etc/nginx/conf.d/
vim default.conf
apt-get update
apt-get install vim -y
# /usr/share/nginx/html
echo >> blank.html
vim default.conf
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index blank.html;
}
nginx -s reload
自 Day 9 利用 docker 安裝 Mautic 到今日的內容,可以使用 docker-compose 來統一控制每個容器間的關聯和相關設定。統整出的 docker-compose.yml
內容如下:
version: "2"
# /user/mautic/mautic_data 和 /user/mautic/database
# 要先取得權限,才能正常執行
# chmod -R 777 /user/mautic/database
# chmod -R 777 /user/mautic/mautic_data
services:
database:
image: powertic/percona-docker
container_name: mautic_database
environment:
MYSQL_ROOT_PASSWORD: mysql-root-password
volumes:
- /user/mautic/database:/var/lib/mysql
restart: always
networks:
- mauticnet
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --sql-mode=""
mautic:
container_name: mautic
image: mautic/mautic:v4
volumes:
- /user/mautic/mautic_data:/var/www/html
environment:
- MAUTIC_DB_HOST=database
- MAUTIC_DB_USER=root
- MAUTIC_DB_PASSWORD=mysql-root-password
- MAUTIC_DB_NAME=mautic4
restart: always
networks:
- mauticnet
ports:
- "8080:80"
volumes:
database: {}
mautic_data: {}
networks:
mauticnet: